<?php


namespace app\index\controller;


use app\model\BottomMenu;
use app\model\Config;
use app\model\UserMenu;

class UsermenuController extends Base
{
    public function list()
    {

        $where['uniacid'] = uniacid();
        $where['status'] = 1;
        $res = UserMenu::where($where)
            ->order('sort asc')
            ->select()
            ->toArray();

        $data = [
            'order'=>['title'=>'订单中心','list'=>[]],
            'function'=>['title'=>'所有功能','list'=>[]],
            'tool'=>['title'=>'常用工具','list'=>[]],
            'admin'=>['title'=>'后台入口','list'=>[]],
        ];

        foreach ($res as $v){
            $v['pagepath'] = $v['url'].$v['params'];
            $data[$v['mo']]['list'][] = $v;
        }
        
        return $this->json(['data' => $data]);
    }
}
